package top.drose;


import java.util.Scanner;

/// 使用动态规划实现
/// https://acm.hdu.edu.cn/showproblem.php?pid=1003
public class P14_1 {
    static Scanner sc = new Scanner(System.in);
    static int[] dp=new int[10001];//以i下标的节点的sum的最大值

    public static void main(String[] args) {
        int t=sc.nextInt();
        for(int k=1;k<=t;k++){
            int n=sc.nextInt();
            for(int i=1;i<=n;i++)dp[i]=sc.nextInt();
            int start=1,end=1,p=1;
            int maxsum=dp[1];
            for(int i=2;i<=n;i++){
                if(dp[i-1]+dp[i]>=dp[i]){
                    dp[i]=dp[i-1]+dp[i];
                }else{
                    p=i;
                }
                if(dp[i]>maxsum){
                    maxsum=dp[i];start=p;end=i;
                }
            }
            System.out.printf("Case #%d:\n",k);
            System.out.printf("%d %d %d\n",maxsum,start,end);
        }
    }
}
